package rpc

import (
	p "gitee.com/nggs/network/protocol"
)

const (
	PH = 0
)

type IProtocol interface {
	IMessageFactoryManager
}

type protocol struct {
	IMessageFactoryManager
	allocator p.IAllocator
}

func New(allocator p.IAllocator) IProtocol {
	proto := &protocol{
		IMessageFactoryManager: newMessageFactoryManager(),
		allocator:              &p.NonAllocator{},
	}
	if allocator != nil {
		proto.allocator = allocator
	}
	return proto
}
